<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CSS 实现灯笼动画</title>
  </head>
  <link rel="stylesheet" href="../common.css" />
  <style>
    :root {
      --lineColor: #ecaa2f;
      --bg: #f00;
    }

    .container {
      width: 200px;
      height: 150px;
      position: relative;
      animation: rotate 3s infinite ease-in-out;
    }

    .center {
      position: relative;
      width: 100%;
      height: 100%;
      background: var(--bg);
      border-radius: 120px;
      box-shadow: 0 0 80px -10px var(--bg);
      animation: rotate 3s infinite ease-in-out;
      transform-origin: top center;
    }

    .center::before {
      content: "";
      position: absolute;
      top: -8px;
      left: calc(50% - 40px);
      width: 80px;
      height: 10px;
      background: var(--lineColor);
      border-radius: 5px 5px 0 0;
      z-index: 2;
    }

    .center::after {
      content: "";
      width: 80px;
      height: 10px;
      background: var(--lineColor);
      border-radius: 0 0 5px 5px;
      position: absolute;
      bottom: -8px;
      left: calc(50% - 40px);
      z-index: 2;
    }

    .center-line {
      width: 100%;
      height: 100%;
    }

    .center-line span {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 18px;
      font-size: 18px;
      color: var(--lineColor);
      font-weight: bold;
    }

    .center-line::before,
    .center-line::after {
      content: "";
      position: absolute;
      top: 0;
      height: 100%;
      border: 2px solid var(--lineColor);
      border-radius: 50%;
    }
    .center-line::before {
      left: calc(50% - 75px);
      width: 150px;
    }

    .center-line::after {
      left: calc(50% - 35px);
      width: 70px;
    }

    .head-line {
      position: absolute;
      left: calc(50% - 2px);
      top: -60px;
      width: 4px;
      height: 60px;
      background-color: var(--lineColor);
    }

    .footer-line {
      position: absolute;
      left: calc(50% - 2px);
      bottom: -50px;
      width: 4px;
      height: 50px;
      background-color: var(--lineColor);
      animation: rotate 3s infinite ease-in-out;
    }

    .footer-line::after {
      content: "";
      position: absolute;
      bottom: -75px;
      left: calc(50% - 8px);
      width: 16px;
      height: 80px;
      background: linear-gradient(
        #f00,
        #e36d00 3px,
        #fbd342 5px,
        #e36d00 8px,
        #e36d00 12px,
        #f00 16px,
        rgba(255, 0, 0, 0.8) 26px,
        rgba(255, 0, 0, 0.6)
      );
      border-radius: 5px 5px 0 0;
    }

    @keyframes rotate {
      0%,
      100% {
        transform: rotate(-10deg);
      }

      50% {
        transform: rotate(10deg);
      }
    }
  </style>

  <body>
    <div class="container">
      <span class="head-line"></span>
      <div class="center">
        <div class="center-line">
          <span>元旦快乐</span>
        </div>
        <span class="footer-line"></span>
      </div>
    </div>
  </body>
</html>
